home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
rlib
/
set
< prev
next >
Wrap
Text File
|
1994-09-23
|
721b
|
39 lines
//-------------------------------------------------------------------//
// set
// Syntax: set ( A )
// Description:
// The set function takes an vector argument (A), and returns a
// vector that is sorted in ascending order, and has no duplicate
// values.
// See Also: complement, intersection, union
//-------------------------------------------------------------------//
set = function ( A )
{
if (min (size (A)) != 1)
{
error ("set: requires vector argument");
}
i = j = 1;
a = sort (A).val;
while (i <= a.n)
{
tmp = find (a[i] == a);
if (tmp.n > 1)
{
s[j] = a[tmp[1]];
i = i + tmp.n;
else
s[j] = a[tmp];
i++;
}
j++;
}
return s
};